﻿using Infrastructure.ElasticSearch.Enums;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;

namespace Infrastructure.ElasticSearch.Nests
{
    public class ElasticSearchItemTermsProperty<T> : ElasticSearchItem<T> where T : class
    {
        public ElasticSearchItemTermsProperty(TermsFieldAttribute termsFieldAttrbute,
            Expression<Func<T, object>> field,
            QueryOperator opera = QueryOperator.Include,
            QueryPositionEnum position = QueryPositionEnum.Must,
            string path = "",
            QueryPositionEnum nestPosition = QueryPositionEnum.None) : base(field, opera, position, path, nestPosition)
        {
            //构造查询field
            SearchFieldName = SearchFieldPre + termsFieldAttrbute.TermsName;

            this.Field = new Nest.Field(SearchFieldName);
        }
    }
}
